home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / e.dxr / 00006_#E01 - sitting in car.ls < prev    next >
Encoding:
Text File  |  1996-02-15  |  7.0 KB  |  201 lines

  1. global gEnvironmentSound, gOBJECTSE, gObjects, gStates, NULLrect, gHotRects, gCursorlist, gWorld, sQTSPRITE, sQTCharSprite, gSoundchannels
  2.  
  3. on doGoToG22
  4.   set initList to [#lookAtPelletDispenser]
  5.   set killList to [#goToG22, #goToF01, #goToH01]
  6.   changeHotSpots(initList, killList, #false)
  7.   setaProp(getaProp(gObjects, #CarDash), #State, #off)
  8.   setaProp(getaProp(gObjects, #CarGasGauge), #fuelLevel, 0)
  9.   changeGasGauge(1, #false)
  10.   genexitkf(#G22)
  11. end
  12.  
  13. on doGoToF01
  14.   set initList to [#lookAtPelletDispenser]
  15.   set killList to [#goToG22, #goToF01, #goToH01]
  16.   changeHotSpots(initList, killList, #false)
  17.   setaProp(getaProp(gObjects, #CarDash), #State, #off)
  18.   setaProp(getaProp(gObjects, #CarGasGauge), #fuelLevel, 0)
  19.   changeGasGauge(1, #false)
  20.   genexitkf(#F01)
  21. end
  22.  
  23. on doGoToH01
  24.   set initList to [#lookAtPelletDispenser]
  25.   set killList to [#goToG22, #goToF01, #goToH01]
  26.   changeHotSpots(initList, killList, #false)
  27.   setaProp(getaProp(gObjects, #CarDash), #State, #off)
  28.   setaProp(getaProp(gObjects, #CarGasGauge), #fuelLevel, 0)
  29.   changeGasGauge(1, #false)
  30.   genexitkf(#H01)
  31. end
  32.  
  33. on doLookAtPelletDispenser
  34.   Jumptokey(#E05)
  35.   CursorandUpdate()
  36. end
  37.  
  38. on doLookLeft
  39.   set initList to []
  40.   set killList to [#carEmerHotRect]
  41.   changeHotSpots(initList, killList, #true)
  42.   Jumptokey(#E03)
  43.   CursorandUpdate()
  44. end
  45.  
  46. on doLookRight
  47.   set droveOrTowed to getaProp(getaProp(gObjects, #GasManQT), #droveOrTowed)
  48.   set runoutCount to getaProp(getaProp(gObjects, #CarGasGauge), #runoutCount)
  49.   if (runoutCount <> 4) or (droveOrTowed <> #towed) or (getaProp(gStates, #Credits) <= 0) then
  50.     Jumptokey(#E04)
  51.   else
  52.     Jumptokey(#E04b)
  53.   end if
  54.   CursorandUpdate()
  55. end
  56.  
  57. on DoCarRadOn
  58.   set OBj to getaProp(gObjects, #CarRadOn)
  59.   set PAR to getaProp(gObjects, getaProp(OBj, #Parent))
  60.   set curState to getaProp(PAR, #State)
  61.   if curState = #on then
  62.     MakeDynamic(getaProp(OBj, #Parent), #State, #off)
  63.     MakeDynamic(#CarRadOn, #DisplayState, #close)
  64.     set whichStation to "E01rad" & getaProp(PAR, #station) & ".aif"
  65.     stopsound(whichStation)
  66.   else
  67.     if curState = #off then
  68.       MakeDynamic(getaProp(OBj, #Parent), #State, #on)
  69.       MakeDynamic(#CarRadOn, #DisplayState, #open)
  70.       set whichStation to "E01rad" & getaProp(PAR, #station) & ".aif"
  71.       playSound(whichStation, #AmbientLoop, 0)
  72.     end if
  73.   end if
  74. end
  75.  
  76. on DocarIgni
  77.   set OBj to getaProp(gObjects, #carIgni)
  78.   set PAR to getaProp(gObjects, getaProp(OBj, #Parent))
  79.   set fuelLevel to getaProp(getaProp(gObjects, #CarGasGauge), #fuelLevel)
  80.   if fuelLevel > 0 then
  81.     set gas to #HaveGAS
  82.   else
  83.     set gas to #NOGAS
  84.   end if
  85.   playSound(getaProp(getProp(OBj, #sound), gas), #cast, 1)
  86.   updateStage()
  87.   if gas = #HaveGAS then
  88.     playSound("E01idle.aif", #cast, 0)
  89.     if getaProp(getaProp(gObjects, #carMap), #curZone) < 375 then
  90.       MakeDynamic(getaProp(OBj, #Parent), #State, #on)
  91.     end if
  92.   end if
  93. end
  94.  
  95. on DocarEmer
  96.   set carEmerObj to getaProp(gObjects, #carEmer)
  97.   if getaProp(getaProp(getaProp(gObjects, #carEmer), #animator), #pbPauseState) = 1 then
  98.     setaProp(getaProp(carEmerObj, #animator), #pbPauseState, 0)
  99.     set timerRef to Startthetimer(300, "doKnock")
  100.     setaProp(carEmerObj, #timerRef, timerRef)
  101.   else
  102.     if not voidp(getaProp(carEmerObj, #animator)) then
  103.       setaProp(getaProp(carEmerObj, #animator), #pbPauseState, 1)
  104.       set whichCast to getAt(getaProp(getaProp(carEmerObj, #cast), #FrameData), 2)
  105.       set SpriteNum to getaProp(carEmerObj, #SpriteNum)
  106.       set the castNum of sprite SpriteNum to whichCast
  107.       DeletetheTimer(getaProp(carEmerObj, #timerRef))
  108.     end if
  109.   end if
  110. end
  111.  
  112. on doKnock
  113.   playSound("E02knock.aif", #cast, 0)
  114.   set initList to [#carLookLeft]
  115.   set killList to []
  116.   changeHotSpots(initList, killList, #true)
  117. end
  118.  
  119. on DoopenCarMap
  120.   set OBj to getaProp(gObjects, #transCarDashView)
  121.   set curScale to getaProp(getaProp(gObjects, #carMap), #curScale)
  122.   setaProp(getaProp(OBj, #cast), #UP, the number of cast string("EG" & curScale & ".pct"))
  123.   MakeDynamic(#transCarDashView, #cast, getaProp(getaProp(gObjects, #transCarDashView), #cast))
  124.   setaProp(getaProp(gObjects, #GasManQT), #clickCount, 1)
  125.   set initList to []
  126.   set killList to [#carLookRight]
  127.   changeHotSpots(initList, killList, #false)
  128.   set mapGaugeObj to getaProp(gObjects, #MapCarGasGauge)
  129.   set carGaugeObj to getaProp(gObjects, #CarGasGauge)
  130.   set fuelLevel to getaProp(getaProp(gObjects, #CarGasGauge), #fuelLevel)
  131.   setaProp(mapGaugeObj, #DisplayState, getAt(getaProp(carGaugeObj, #allStates), fuelLevel + 1))
  132.   setaProp(mapGaugeObj, #fuelLevel, fuelLevel)
  133.   Jumptokey(#E02)
  134.   CursorandUpdate()
  135. end
  136.  
  137. on DoCarRadTuneLft
  138.   set OBj to getaProp(gObjects, #CarRadio)
  139.   set nStations to count(getaProp(OBj, #stationLocs))
  140.   set whichStation to getaProp(OBj, #station)
  141.   if whichStation > 1 then
  142.     set stationName to "E01rad" & whichStation & ".aif"
  143.     stopsound(string(stationName))
  144.     set whichStation to whichStation - 1
  145.     set newStation to getAt(getaProp(OBj, #stationLocs), whichStation)
  146.     MakeDynamic(#CarRadio, #loc, newStation)
  147.     MakeDynamic(#CarRadio, #station, whichStation)
  148.     set the loc of sprite 10 to newStation
  149.     set stationName to "E01rad" & whichStation & ".aif"
  150.     playSound(stationName, #AmbientLoop, 0)
  151.   end if
  152. end
  153.  
  154. on DoCarRadTuneRt
  155.   set OBj to getaProp(gObjects, #CarRadio)
  156.   set nStations to count(getaProp(OBj, #stationLocs))
  157.   set whichStation to getaProp(OBj, #station)
  158.   if whichStation < 5 then
  159.     set stationName to "E01rad" & whichStation & ".aif"
  160.     stopsound(string(stationName))
  161.     set whichStation to whichStation + 1
  162.     set newStation to getAt(getaProp(OBj, #stationLocs), whichStation)
  163.     MakeDynamic(#CarRadio, #loc, newStation)
  164.     MakeDynamic(#CarRadio, #station, whichStation)
  165.     set the loc of sprite 10 to newStation
  166.     set stationName to "E01rad" & whichStation & ".aif"
  167.     playSound(stationName, #AmbientLoop, 0)
  168.   end if
  169. end
  170.  
  171. on changeGasGauge newStateNum, onFrame
  172.   set OBj to getaProp(gObjects, #CarGasGauge)
  173.   set newState to getAt(getaProp(OBj, #allStates), newStateNum)
  174.   MakeDynamic(#CarGasGauge, #DisplayState, newState)
  175.   if onFrame = #true then
  176.     set GaugeSpriteNum to getaProp(OBj, #SpriteNum)
  177.     set the castNum of sprite GaugeSpriteNum to getaProp(getaProp(OBj, #cast), newState)
  178.   end if
  179.   CursorandUpdate()
  180. end
  181.  
  182. on updateGasGauge
  183.   set OBj to getaProp(gObjects, #CarGasGauge)
  184.   set the castNum of sprite getaProp(OBj, #SpriteNum) to getaProp(getaProp(OBj, #cast), getaProp(OBj, #DisplayState))
  185.   CursorandUpdate()
  186. end
  187.  
  188. on decrementGasGauge
  189.   set carGaugeObj to getaProp(gObjects, #CarGasGauge)
  190.   set mapGaugeObj to getaProp(gObjects, #MapCarGasGauge)
  191.   set newFuelLevel to getaProp(carGaugeObj, #fuelLevel) - 1
  192.   if newFuelLevel = -1 then
  193.     exit
  194.   end if
  195.   setaProp(carGaugeObj, #fuelLevel, newFuelLevel)
  196.   setaProp(carGaugeObj, #DisplayState, getAt(getaProp(carGaugeObj, #allStates), newFuelLevel + 1))
  197.   setaProp(mapGaugeObj, #DisplayState, getAt(getaProp(carGaugeObj, #allStates), newFuelLevel + 1))
  198.   set the castNum of sprite getaProp(mapGaugeObj, #SpriteNum) to getaProp(getaProp(carGaugeObj, #cast), getaProp(carGaugeObj, #DisplayState))
  199.   CursorandUpdate()
  200. end
  201.